/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PainelInferior.java
 *
 * Created on 04/10/2011, 11:22:40
 */
package projetointegrado;

import java.awt.event.KeyEvent;

/**
 *
 * @author Emerson
 */
public class PainelInferior extends javax.swing.JPanel {
    public String texto = "";
    KeyboardInput keyInput = new KeyboardInput();
    public PainelInferior() {
            
        initComponents();
        
    }

    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    
    
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        labelSkillHum = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jButton1 = new javax.swing.JButton();

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        setBackground(new java.awt.Color(255, 255, 255));
        setOpaque(false);
        setPreferredSize(new java.awt.Dimension(830, 83));
        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        labelSkillHum.setText("           ");
        add(labelSkillHum, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, -1, -1));

        jTextField1.setBackground(new java.awt.Color(153, 153, 153));
        jTextField1.setFont(new java.awt.Font("DejaVu Sans", 1, 13));
        jTextField1.setForeground(new java.awt.Color(255, 249, 0));
        jTextField1.setCaretColor(new java.awt.Color(254, 232, 6));
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });
        jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField1KeyPressed(evt);
            }
        });
        add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 63, 780, -1));

        jScrollPane2.setWheelScrollingEnabled(false);

        jTextArea2.setBackground(new java.awt.Color(102, 102, 102));
        jTextArea2.setColumns(20);
        jTextArea2.setEditable(false);
        jTextArea2.setRows(5);
        jScrollPane2.setViewportView(jTextArea2);

        add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 830, 57));

        jButton1.setText("Ok");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });
        add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(780, 63, 50, 20));
    }// </editor-fold>//GEN-END:initComponents

    private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyPressed
        
    }//GEN-LAST:event_jTextField1KeyPressed

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
        texto = jTextField1.getText();
        Flag.contadorDeClock = 0;
        DesenhaTela.playerFalou(texto);
        if(texto.equalsIgnoreCase("exura")){
            if(ProjetoIntegrado.player.getManaAtual() >= 100){
                if(ProjetoIntegrado.player.getHpAtual()< ProjetoIntegrado.player.getHp())
            {
            ProjetoIntegrado.player.setHpAtual(ProjetoIntegrado.player.getHpAtual() + 50);
            ProjetoIntegrado.player.setManaAtual(ProjetoIntegrado.player.getManaAtual() - 100);
            }
        }
        }else if(texto.equalsIgnoreCase("utani hur")){
            if(ProjetoIntegrado.player.getManaAtual() >= 50){
            ProjetoIntegrado.player.dx = 20;
            ProjetoIntegrado.player.dy = 20;
            ProjetoIntegrado.player.setManaAtual(ProjetoIntegrado.player.getManaAtual() - 50);
            }
        }
        jTextField1.setText("");
    }//GEN-LAST:event_jTextField1ActionPerformed

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        texto = jTextField1.getText();
        Flag.contadorDeClock = 0;
        DesenhaTela.playerFalou(texto);
        if(texto.equalsIgnoreCase("exura")){
            if(ProjetoIntegrado.player.getManaAtual() >= 100){
                if(ProjetoIntegrado.player.getHpAtual()< ProjetoIntegrado.player.getHp())
            {
            ProjetoIntegrado.player.setHpAtual(ProjetoIntegrado.player.getHpAtual() + 50);
            ProjetoIntegrado.player.setManaAtual(ProjetoIntegrado.player.getManaAtual() - 100);
            }
        }
        }else if(texto.equalsIgnoreCase("utani hur")){
            if(ProjetoIntegrado.player.getManaAtual() >= 50){
            ProjetoIntegrado.player.dx = 20;
            ProjetoIntegrado.player.dy = 20;
            ProjetoIntegrado.player.setManaAtual(ProjetoIntegrado.player.getManaAtual() - 50);
            }
        }
    }//GEN-LAST:event_jButton1MouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JLabel labelSkillHum;
    // End of variables declaration//GEN-END:variables
}
